package pl.edu.agh.hollonCommision.graph.connectionModel;
import dtp.commission.Commission;


public class DeliveryLocationProximityConnection implements IConnectionModel {

	private double distance;
	
	public DeliveryLocationProximityConnection(double distance) {
		this.distance = distance;
	}
	
	@Override
	public boolean areConnected(Commission commission, Commission commission2) {
		double x = commission.getDeliveryX() - commission2.getDeliveryX();
		double y = commission.getDeliveryY() - commission2.getDeliveryY();
		return (Math.sqrt(x * x + y * y) < distance );
	}

}
